import fetch from 'utils/fetch';


// 查询
export function getLessonListByParams(page,rows,fSchoolId,sTitle,sTeacherName,sStatus,sStartTime,sExpectEndTime){
    const data = {
        fSchoolId,
        sTitle,
        sTeacherName,
        sStatus,
        sStartTime,
        sExpectEndTime
    };
    return fetch({
        url:'/courseDetail/pageCourseDetail/'+ page +'/'+ rows,
        method: 'post',
        data,
    });
}


// 评论查询
export function getCommentListByParams(fCourseId,userName,page,rows,sXiaoxinCode,sCommentContent,startTime,endTime){
    const data = {
        fCourseId,
        userName,
        sXiaoxinCode,
        sCommentContent,
        startTime,
        endTime
    };
    return fetch({
        url:'/courseComment/queryCourseCommentByPage/' + page + '/' + rows,
        method: 'post',
        data,
    });
}

// 结束课程
export function stopLessonByPid(pId,sReason){
    const data = {
        pId,
        sReason
    };
    return fetch({
        url:'/courseDetail/endCourseDetailByPid',
        method: 'post',
        data,
    });
}

// 查看课程详情
export function getLessonDetailByPid(pid){
    return fetch({
        url:'/courseDetail/queryCourseDetailByPid/'+ pid,
        method: 'post'
    });

}

// 回复评论
export function setReplyByPid(pId,sReplyContent){
    const data = {
        pId,
        sReplyContent
    };
    return fetch({
        url:'/courseComment/addReply',
        method: 'post',
        data,
    });
}

// 评论的显示与隐藏
export function modifyCommentStateByPid(pId,sIsHide){
    const data = {
        pId,
        sIsHide
    };
    return fetch({
        url:'/courseComment/updateIsHide',
        method: 'post',
        data,
    });
}

// 判断学校是否有可用的摄像头
export function checkCameraBySchoolId(fSchoolId){
    const data = {
        fSchoolId  
    };
    return fetch({
        url:'/courseDetail/queryLiveDevice',
        method: 'post',
        data,
    });
}

// 判断学校是否开通了空中课堂服务
export function queryCourseDetailRole(schoolId){
    const data = {
    };
    return fetch({
        url:'/courseDetail/queryCourseDetailRole/'+ schoolId,
        method: 'post',
        data,
    });
}

// 新增课程
export function addNewLesson(fSchoolId,sSchoolName,sTitle,sPicture,sStartTime,sExpectEndTime,fDeviceId,sAngleView,sSuitPeople,sHighlights,sTeacherName,sTeacherPicture,sTeacherIntroduction,sCourseware,sCoursewareName,sCoursewareSize,sTags){
    const data = {
        fSchoolId,
        sSchoolName,
        sTitle,
        sPicture,
        sStartTime,
        sExpectEndTime,
        fDeviceId,
        sAngleView,
        sSuitPeople,
        sHighlights,
        sTeacherName,
        sTeacherPicture,
        sTeacherIntroduction,
        sCourseware,
        sCoursewareName,
        sCoursewareSize,
        sTags 
    };
    return fetch({
        url:'/courseDetail/addCourseDetail',
        method: 'post',
        data,
    });
}

// 修改课程详情
export function updateLesson(pId,sHighlights,sTeacherName,sTeacherPicture,sTeacherIntroduction,sCourseware,sCoursewareName,sCoursewareSize){
    const data = {
        pId,
        sHighlights,
        sTeacherName,
        sTeacherPicture,
        sTeacherIntroduction,
        sCourseware,
        sCoursewareName,
        sCoursewareSize
    };
    return fetch({
        url:'/courseDetail/updateCourseDetailByPid',
        method: 'post',
        data,
    });
}
